<!DOCTYPE html>
<html>

	<head>

		<title>大同市电动车管理系统</title>
		<meta http-equiv="Expires" CONTENT="0">
		<meta http-equiv="Cache-Control" CONTENT="no-cache">
		<meta http-equiv="Pragma" CONTENT="no-cache">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="renderer" content="webkit">
		<%include("/common/include.html"){}%>
		<script type="text/javascript" src="${cxt!}/sb/js/comet4j.js"></script>
	</head>
	<style>
		.theme-tab-green-block .tabs li.tabs-selected a.tabs-inner {
			background: #00349a;
			color: #fff;
		}
		/* .panel-title{
				color:#fff;
			}  */
		
		.top_bj {
			/*  background:url(${cxt!}/sb/img/top_bj.jpg) repeat-x;  */
			background: #00349a;
			height: 79px;
		}
		
		.top_bj img {
			margin-left: 1.5%;
		}
		
		.accordion .accordion-header-selected {
			background: #3673f6;
		}
		
		.nav span {
			/* margin-right:2%; */
			cursor: pointer;
			color: #fff;
			font-family: 宋体;
			background:url(${cxt!}/sb/img/nav_bj.png) no-repeat;
			width: 104px;
			height: 30px;
			/* background: #000; */
		}
		
		.nav span.cur {
			background: url(${cxt!}/sb/img/nav_bj1.png) no-repeat; 
		/* 	background: #00349a; */
			/* color:#000; */
			font-weight: bold;
		}
		
		.tree-node-hover,
		.tree-node-selected {
			background: #91b4ff;
			color: #fff;
			padding: 5px 0;
			margin: 5px 0;
		}
		
		.tree-node {
			padding: 5px 0;
			margin: 5px 0;
		}
		
		.theme-tab-green-block .tabs li.tabs-selected a.tabs-inner {
			border-bottom: 1px solid #00349a;
		}
	</style>
	<script type="text/javascript">
		$(function() {
			$(".accordion-body").attr("style","height:500px;");
			// 选项卡
			var mainTabs = $('#mainTabs');

			// 选项卡菜单
			var tabsMenu = $('#tabsMenu').menu({
				onClick: function(item) {
					var curTabTitle = $(this).data('tabTitle');
					var type = $(item.target).attr('type');

					if(type === 'close') {
						var t = mainTabs.tabs('getTab', curTabTitle);
						if(t.panel('options').closable) {
							mainTabs.tabs('close', curTabTitle);
						}
						return;
					}

					var allTabs = mainTabs.tabs('tabs');
					var closeTabsTitle = [];

					$.each(allTabs, function() {
						var opt = $(this).panel('options');
						if(opt.closable && opt.title != curTabTitle &&
							type === 'closeOther') {
							closeTabsTitle.push(opt.title);
						} else if(opt.closable && type === 'closeAll') {
							closeTabsTitle.push(opt.title);
						}
					});

					for(var i = 0; i < closeTabsTitle.length; i++) {
						mainTabs.tabs('close', closeTabsTitle[i]);
					}
				}
			});
			// 初始化选项卡
			 mainTabs.tabs({
				fit: true,
				border: false,
				/* tools: [{
					text: '最大化',
					iconCls: 'icon-arrowoutlonger',
					handler: function() {
						$('#mainLayout').layout("collapse", "north").layout("collapse", "west");
					}
				}, {
					text: '刷新',
					iconCls: 'icon-arrowrefresh',
					handler: refresh
				}, {
					text: '操作',
					iconCls: 'icon-set',
					handler: function(e) {
						var winW = $(window).width();
						$('#menu').menu('show', {
							left: (winW - 120) + "px",
							top: "102px"
						});
					}
				}], */
				onContextMenu: function(e, title) {
					e.preventDefault();
					tabsMenu.menu('show', {
						left: e.pageX,
						top: e.pageY
					}).data('tabTitle', title);
				}
			}); 
			// 初始化添加默认主页
			var mainOpts = {
				fit: true,
				title: '管理中心',
				closable: false,
				border: false,
				//			iconCls : 'icon-feed',
				//content: '<iframe id="mainFrame" name="mainFrame" src="${cxt!}/center" allowTransparency="true" style="border: 0; width: 100%; height: 99%;" frameBorder="0"></iframe>'
			};

			mainTabs.tabs('add', mainOpts);
		});
	</script>

	<body id="mainLayout" class="easyui-layout">

		<div data-options="region:'north',border: false" class="top_bj" style="position:relative;height:101px;">
			<div style="float:left;">
				<img src="${cxt!}/sb/img/top_logo.png" />
			</div>
			<div style="float:right;margin:8px;">
				<div onclick="toPersonalInformation()" style="float:left;cursor:pointer;">
					<span style="color:#fff">修改密码</span>
				</div>
				<div onclick="exit()" style="float:left;margin-left:10px;float:left;cursor:pointer;">
					<span style="color:#fff">安全退出</span>
				</div>
			</div>
			<div style="clear:both"></div>
			<div style="margin-left:200px;" class="nav" id="siteMenu">
				<% include("/index/menu2.html"){} %>
			</div>
		</div>
		<div id="menu_left" data-options="region:'west',href:'',split:true" title="欢迎-${user.name! }" style="width: 200px; ">
			<% include("/index/menu3.html"){} %>
		</div>
		<div data-options="region:'center'" style="overflow: hidden;">
			<div id="mainTabs" class="easyui-tabs theme-tab-green-block" data-options="tabPosition:'top'"></div>
			<!-- <div id="menu" class="easyui-menu" style="width:120px;position">
				<div onclick="toDetailAnnounce()">
					<span>我的通告</span>
				</div>
				<div class="menu-sep"></div>
				<div onclick="toPersonalInformation()">
					<span>修改密码</span>
				</div>
				<div class="menu-sep"></div>
				<div onclick="exit()">
					<span>安全退出</span>
				</div>
			</div> -->
		</div>
		<div data-options="region:'south',border:false" style="height: 30px; overflow: hidden; text-align: center;background-color: #00349a;">
			<p style="margin-top: 8px;color: #fff;">技术支持：太原市迅普高科电子科技有限公司&nbsp;&nbsp;&nbsp;电话：0351-7232123</p>
		</div>

		<div id="tabsMenu">
			<div data-options="iconCls:'icon-applicationdelete'" type="close">关闭</div>
			<div data-options="iconCls:'icon-cancel'" type="closeOther">关闭其他</div>
			<div data-options="iconCls:'icon-cross'" type="closeAll">关闭所有</div>
		</div>
		<script type="text/javascript">
			function nodeClick(title, url) {

				var mainTabs = $('#mainTabs');

				if(url) {
					var src = cxt + url;
					if(!sy.startWith(url, '/')) {
						src = cxt + url;
					}
					var opts = {
						title: title,

						closable: true,
						// 						iconCls : node.iconCls,
						content: sy
							.formatString(
								'<iframe src="{0}" allowTransparency="true" style="border:0;width:100%;height:99%;" frameBorder="0"></iframe>',
								src),
						border: false,
						fit: true
					};
					if(mainTabs.tabs('exists', title)) {
						mainTabs.tabs('select', title);
						var current_tab = mainTabs.tabs('getSelected');
						mainTabs.tabs('update', {
							tab: current_tab,
							options: {
								content: sy
									.formatString(
										'<iframe src="{0}" allowTransparency="true" style="border:0;width:100%;height:99%;" frameBorder="0"></iframe>',
										src),
								//或者 href : ''; 
							}
						});
					} else {

						/* 备注：此代码为easyUI多页面改为单页面代码，删除后可恢复多页面 */
						var mainTabs = $('#mainTabs');
						var allTabs = mainTabs.tabs('tabs');
						var closeTabsTitle = [];

						$.each(allTabs, function() {
							var opt = $(this).panel('options');
							closeTabsTitle.push(opt.title);
						});

						for(var i = 1; i < closeTabsTitle.length; i++) {
							mainTabs.tabs('close', closeTabsTitle[i]);
						}
						/* 后加 */

						ZENG.msgbox.show("正在加载...", 6, 1000000);
						mainTabs.tabs('add', opts);
					}
				}
			}

			function refresh() {
				ZENG.msgbox.show("正在加载...", 6, 1000000);
				var mainTabs = $('#mainTabs');
				var panel = mainTabs.tabs('getSelected').panel('panel');
				var frame = panel.find('iframe');
				try {
					if(frame.length > 0) {
						for(var i = 0; i < frame.length; i++) {
							frame[i].contentWindow.document.write('');
							frame[i].contentWindow.close();
							var src = frame[i].src;
							var index = src.lastIndexOf("?");
							if(index != -1) {
								frame[i].src = src.substr(0, index);
							} else {
								frame[i].src = src;
							}
						}
						if(navigator.userAgent.indexOf("MSIE") > 0) { // IE特有回收内存方法
							try {
								CollectGarbage();
							} catch(e) {}
						}
					}
				} catch(e) {}
			}

			// 右下角弹窗提示
			function slideMsg(str) {
				if(str.indexOf('新的通知') >= 0) {
					var str1 = str.split("|")[0];
					var str2 = str.split("|")[1];

					str = "<a  onclick=toXq1('" + str2 + "') >" + str1 + "</a>";
					$.messager.show({
						title: '操作提示',
						msg: str,
						timeout: 1500 * 30,
						showType: 'slide'
					});
				} else {
					$.messager.show({
						title: '操作提示',
						msg: str,
						timeout: 1500,
						showType: 'slide'
					});
				}

			}
			//安全退出
			function exit() {
				window.location.href = cxt + "/login/logout";
			}

			function alterPassword() {
				window.location.href = "";
			}
		</script>
		<script type="text/javascript">
			/* 备注：此代码为easyUI左侧菜单栏改为上方，删除后可恢复左侧菜单栏  */

			$(function() {
				$(".easyui-accordion>.panel").children().hide();
				$(".easyui-accordion>.panel:eq(0)").find('.panel-body').show();
			})

			function menu1(ids) {
				$("#" + ids).parent().siblings().children().hide();
				$("#" + ids).show();
				/* 备注：此代码为easyUI多页面改为单页面代码，删除后可恢复多页面 */
				var mainTabs = $('#mainTabs');
				var allTabs = mainTabs.tabs('tabs');
				var closeTabsTitle = [];

				$.each(allTabs, function() {
					var opt = $(this).panel('options');
					closeTabsTitle.push(opt.title);
				});

				for(var i = 1; i < closeTabsTitle.length; i++) {
					mainTabs.tabs('close', closeTabsTitle[i]);
				}
				/* 后加 */
			};
			$(function() {
				$(".nav span").click(function() {
					$(".nav span").eq($(this).index()).addClass("cur").siblings().removeClass("cur");
				})
			})
			<!--导航选中状态切换-->
	
		var urlstr = location.href;
		var urlstatus = false;
		$("#siteMenu span").each(function() {

			if((urlstr + '/').indexOf($(this).attr('href')) > -1 && $(this).attr('href') != '') {
				$(this).addClass('cur');
				urlstatus = true;
			} else {
				$(this).removeClass('cur');
			}
			if($("#siteMenu span.cur").length > 1) {
				$("#siteMenu span").eq(0).removeClass('cur');
			}
		});
		if(!urlstatus) {
			$("#siteMenu span").eq(0).addClass('cur');
		}
		$('#refreshbtn').click(function() {
	        $("#t_auclot").datagrid("reload",serializeForm($('#mysearch')));
	    });
			/* 后加 */
			/* var websocket = null;
		    //判断当前浏览器是否支持WebSocket
		    if ('WebSocket' in window) {
		     //   websocket = new WebSocket("ws://127.0.0.1:8080/shouba2.0/websocket/${user.username! }");
		    } else {
		     //   alert('当前浏览器 Not support websocket')
		    }
		
		    //连接发生错误的回调方法
		    websocket.onerror = function () {
		        setMessageInnerHTML("WebSocket连接发生错误");
		    };
		
		    //连接成功建立的回调方法
		    websocket.onopen = function () {
		        setMessageInnerHTML("WebSocket连接成功");
		    }
		
		    //接收到消息的回调方法
		    websocket.onmessage = function (event) {
		        setMessageInnerHTML(event.data);
		    	
		    }
		
		    //连接关闭的回调方法
		    websocket.onclose = function () {
		        setMessageInnerHTML("WebSocket连接关闭");
		    }
		
		    //监听窗口关闭事件，当窗口关闭时，主动去关闭websocket连接，防止连接还没断开就关闭窗口，server端会抛异常。
		    window.onbeforeunload = function () {
		        closeWebSocket();
		    }
		
		    //将消息显示在网页上
		    function setMessageInnerHTML(innerHTML) {
		    	slideMsg(innerHTML);
		//         document.getElementById('message').innerHTML += innerHTML + '<br/>';
		    }
		
		    //关闭WebSocket连接
		    function closeWebSocket() {
		        websocket.close();
		    }
		
		    //发送消息
		    function send() {
		        var message = document.getElementById('text').value;
		        websocket.send(message);
		        websocket.send(JSON.stringify({
		        	  to: "client2",
		        	  data: "foo"
		        	}));
		    } */
			//点击操作里的公告，跳转到详细公告页面
			function toDetailAnnounce() {
				parent.window.nodeClick("我的通告", "/detailAnnounce");
			}
			//点击操作里的个人资料，跳转到个人资料设置页面
			function toPersonalInformation() {
				parent.window.nodeClick("修改密码设置", "/personalInformation");
			}

			function toXq1(id) {
				parent.window.nodeClick("公告详情", "/detailAnnounce/check?ids=" + id);
			}
		</script>
	</body>

</html>